import {message} from "antd";

const optMessage = async (func: Function, optName: string)=>{
  const hide = message.loading('正在'+optName);
  try {
    await func();
    hide();
    message.success(optName+"成功");
    return true;
  }catch (e) {
    hide();
    message.error(optName+"失败，请稍后重试");
    return false;
  }
}

export {optMessage};
